package com.example.canteeradiodemo;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    private ImageView iv_horn;
    private TextView tv_left_content,tv_right_content;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // 获取界面控件
        iv_horn=findViewById(R.id.iv_horn);
        tv_left_content=findViewById(R.id.tv_left_content);
        tv_right_content=findViewById(R.id.tv_right_content);
        // TODO 2 注册广播

        iv_horn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO 3 发送广播
            }
        });
    }
    class MyBroadcastReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO 1 处理接收到的广播信息
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        // TODO 4 注销广播
    }
}